/*
 * @Description: 封装ajax
 * @Author: rendc
 * @Date: 2021-09-09 14:45:01
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-09 15:05:32
 */
var qs = Qs;
var baseURL = "http://203.195.246.58:8888";
var myAjax = {
  get: function (url, params, success, error) {
    var httpRequest = new XMLHttpRequest();
    httpRequest.open("get", baseURL + url + "?" + qs.stringify(params));
    // 配置token
    httpRequest.setRequestHeader("Authorization", sessionStorage.getItem("token"));
    // 发送请求
    httpRequest.send();
    httpRequest.onreadystatechange = function () {
      if (httpRequest.readyState === 4 && httpRequest.status === 200) {
        success(JSON.parse(httpRequest.responseText));
      }
      if (httpRequest.readyState === 4 && httpRequest.status === 500) {
        error(JSON.parse(httpRequest.responseText));
      }
    }
  }

  // postJson:
}